/*
 * @Author: Jone XIn
 * @Date: 2022-02-05 22:42:02
 * @LastEditTime: 2022-02-07 19:09:19
 * @Description: messageFunc
 */

/**
 * status:200
 * @param data 数据
 * @param message 消息
 * @returns 消息对象
 */
export const successNews = (data?: any, message?: string) => {
    return {
        code: 200,
        data: data || [],
        message: message || '请求成功!'
    }
}

/**
 * catch的错误=> status: 500
 * @param data 数据
 * @param message 消息
 * @returns 消息对象
 */
export const catchErrNews = (data?: any, message?: string) => {
    console.log(data);
    return {
        code: 500,
        data: data || [],
        message: message || '服务器内部错误!'
    }
}

/**
 * 客户端参数err => status: 401
 * @param data 数据
 * @param message 消息
 * @returns 消息对象
 */
export const paramsErrNews = (data?: any, message?: string) => {
    return {
        code: 401,
        data: data || [],
        message: message || '请检查客户端参数!'
    }
}

